import { CHANGE_NAME, INCREMENT, DECREMENT, CHANGEBANNER } from "./constants"
const defaulData = {
    name: "cq",
    age: 19,
    counter: 100,
    banners:[],
}
export function reduxer(state = defaulData, action)
{
    console.log("数据：", action);
    switch (action.type)
    {
        case CHANGE_NAME:
            return { ...state, name: action.name };
        case INCREMENT:
            return { ...state, counter: state.counter + action.counter };
        case DECREMENT:
            return { ...state, counter: state.counter + action.counter };
        case CHANGEBANNER:
            return { ...state, banners:action.banners};
        default:
            return {...state}
    }
}